<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

<h:head>
    <title>三一 - 问卷调查</title>
    <link href="../../css/component.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="../../js/highcharts.js"></script>
    <script type="text/javascript" src="../../js/drawChart.js"></script>
</h:head>

<h:body>
    <ui:param name="bean" value="#{adDayAllReportAction}"/>

    <span class="pagetitle">市场数据分析 —— 广告日数据</span>
    <p:separator/>

    <!-- 右侧页面顶部查询部分 -->
    <h:form id="fsearch">
        <h:outputLabel id="radioHide" value="#{bean.dateRadio}" style="visibility: hidden"/>

        <p:outputPanel id="customPanel" style="margin-bottom:10px">
            <p:selectOneRadio id="customRadio" value="#{bean.dateRadio}" layout="custom">
                <f:selectItem itemLabel="1" itemValue="1"/>
                <f:selectItem itemLabel="7" itemValue="7"/>
                <f:selectItem itemLabel="15" itemValue="15"/>
                <f:selectItem itemLabel="30" itemValue="30"/>
                <f:selectItem itemLabel="0" itemValue="0"/>
            </p:selectOneRadio>

            <h:panelGrid id="opt" columns="20" cellpadding="8">
                <p:radioButton id="opt5" for="customRadio" itemIndex="0"/>
                <h:outputLabel for="opt5" value="昨天"/>
                <h:outputLabel/>

                <p:radioButton id="opt1" for="customRadio" itemIndex="1"/>
                <h:outputLabel for="opt1" value="近7天"/>
                <h:outputLabel/>

                <p:radioButton id="opt2" for="customRadio" itemIndex="2"/>
                <h:outputLabel for="opt2" value="近15天"/>
                <h:outputLabel/>

                <p:radioButton id="opt3" for="customRadio" itemIndex="3"/>
                <h:outputLabel for="opt3" value="近30天"/>
                <h:outputLabel/>

                <p:radioButton id="opt4" for="customRadio" itemIndex="4"/>
                <h:outputLabel for="opt4" value="自定义 开始时间"/>
                <p:calendar value="#{bean.dateStart}" mode="popup" pattern="yyyy-MM-dd">
                </p:calendar>
                <h:outputLabel for="opt4" value="结束时间"/>
                <p:calendar value="#{bean.dateEnd}" mode="popup" pattern="yyyy-MM-dd">
                </p:calendar>
            </h:panelGrid>
            <h:panelGrid columns="9">
                <p:selectCheckboxMenu id="menuAffiliation" value="#{bean.selectedAffiliation}" label="归属"
                                      filter="true" filterMatchMode="startsWith" style="width:150px">
                    <f:selectItems value="#{bean.affiliation}"/>
                </p:selectCheckboxMenu>
                <p:selectCheckboxMenu id="menuChannelName" value="#{bean.selectedChannelName}" label="渠道名称"
                                      filter="true" filterMatchMode="startsWith" style="width:150px">
                    <f:selectItems value="#{bean.channelName}"/>
                </p:selectCheckboxMenu>
                <p:selectCheckboxMenu id="menuAgent" value="#{bean.selectedAgent}" label="代理商"
                                      filter="true" filterMatchMode="startsWith" style="width:150px">
                    <f:selectItems value="#{bean.agent}"/>
                </p:selectCheckboxMenu>
                <p:selectCheckboxMenu id="menuPlatform" value="#{bean.selectedPlatform}" label="平台"
                                      filter="true" filterMatchMode="startsWith" style="width:150px">
                    <f:selectItems value="#{bean.platform}"/>
                </p:selectCheckboxMenu>
                <p:selectCheckboxMenu id="menuPaytype" value="#{bean.selectedPaytype}" label="结算方式"
                                      filter="true" filterMatchMode="startsWith" style="width:150px">
                    <f:selectItems value="#{bean.paytype}"/>
                </p:selectCheckboxMenu>
                <p:selectCheckboxMenu id="menuAdvPosition" value="#{bean.selectedAdvPosition}" label="广告位置"
                                      filter="true" filterMatchMode="startsWith" style="width:150px">
                    <f:selectItems value="#{bean.advPosition}"/>
                </p:selectCheckboxMenu>
                <p:commandButton id="ajax" value="查询" update=":#{p:component('dform')} :fsearch"
                                 action="#{bean.search()}"/>
            </h:panelGrid>
        </p:outputPanel>

        <p:growl id="growl" showDetail="true" sticky="true"/>
    </h:form>
    <br/>

    <!-- 数据展示部分，包含表格和图表 -->
    <h:form id="dform">
        <h:panelGrid columns="1" style="width:100%">
            <div id="basewidth" style="width:92%;height:0; border:0;"/>
        </h:panelGrid>
        <div class="data" id="data">
            <p:panel id="panel" header="详细数据" style="margin-bottom:10px;">
                <p:dataTable id="dlist1" var="l" value="#{bean.activeTranDatas}" scrollable="true"
                             resizableColumns="true" paginator="true" paginatorPosition="top"
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}"
                             rowsPerPageTemplate="15,30" rows="15" style="text-align:center;">
                    <f:facet name="{Exporters}">
                        <h:commandLink styleClass="exporter">
                            <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                            <p:dataExporter type="xls" target="dlist1"
                                            fileName="instanceStayActiveRadios-#{pageHelper.getNewDateDetailStr()}"/>
                        </h:commandLink>
                    </f:facet>
                    <p:column headerText="日期" styleClass="column grcnewDevice" sortBy="#{l.dateStr}">
                        <h:outputLabel value="#{l.dateStr}"/>
                    </p:column>
                    <p:column headerText="点击设备" styleClass="column grcnewDevice" sortBy="#{l.clkEquipment}">
                        <h:outputLabel value="#{l.clkEquipment}"/>
                    </p:column>
                    <p:column headerText="激活设备" styleClass="column grcnewUser" sortBy="#{l.actEquipment}">
                        <h:outputLabel value="#{l.actEquipment}"/>
                    </p:column>
                    <p:column headerText="实际激活" styleClass="column grcnewUser" sortBy="#{l.newActive}">
                        <h:outputLabel value="#{l.newActive}"/>
                    </p:column>
                    <p:column headerText="新增设备" styleClass="column grcnewUser" sortBy="#{l.newEquipment}">
                        <h:outputLabel value="#{l.newEquipment}"/>
                    </p:column>
                    <p:column headerText="新增账号" styleClass="column grcnewUser" sortBy="#{l.newAccount}">
                        <h:outputLabel value="#{l.newAccount}"/>
                    </p:column>
                    <p:column headerText="新增付费金额" styleClass="column grcnewUser" sortBy="#{l.newPay}">
                        <h:outputLabel value="#{l.newPay}"/>
                    </p:column>
                    <p:column headerText="付费率" styleClass="column grcnewUser" sortBy="#{l.payrate}">
                        <h:outputLabel value="#{l.payrate}"/>
                    </p:column>
                    <p:column headerText="折后成本" styleClass="column grcnewUser" sortBy="#{l.discount}" rendered="false">
                        <h:outputLabel value="#{l.discount}"/>
                    </p:column>
                    <p:column headerText="CPA" styleClass="column grcnewUser" sortBy="#{l.cpa}" rendered="false">
                        <h:outputLabel value="#{l.cpa}"/>
                    </p:column>
                    <p:column headerText="累计充值【90日】" styleClass="column grcnewUser" sortBy="#{l.totalpay}">
                        <h:outputLabel value="#{l.totalpay}"/>
                    </p:column>
                    <p:column headerText="累计付费账号数" styleClass="column grcnewUser" sortBy="#{l.num}">
                        <h:outputLabel value="#{l.num}"/>
                    </p:column>
                    <p:column headerText="累计付费率" styleClass="column grcnewUser" sortBy="#{l.tpr}">
                        <h:outputLabel value="#{l.tpr}"/>
                    </p:column>
                    <p:column headerText="渠道后ROI(%)" styleClass="column grcnewUser" sortBy="#{l.roi}" rendered="false">
                        <h:outputLabel value="#{l.roi}"/>
                    </p:column>

                    <p:columnGroup type="footer">
                        <p:row>
                            <p:column style="text-align:right" footerText="Totals:"/>
                            <p:column footerText="#{bean.sumClkEquipment}"/>
                            <p:column footerText="#{bean.sumActEquipment}"/>
                            <p:column footerText="#{bean.sumNewActive}"/>
                            <p:column footerText="#{bean.sumNewEquipment}"/>
                            <p:column footerText="#{bean.sumNewAccount}"/>
                            <p:column footerText="#{bean.sumNewPay}"/>
                            <p:column footerText="#{bean.sumPayrate}"/>
                            <p:column footerText="#{bean.sumDiscount}" rendered="false"/>
                            <p:column footerText="#{bean.sumCpa}" rendered="false"/>
                            <p:column footerText="#{bean.sumTotalpay}"/>
                            <p:column footerText="#{bean.sumNum}"/>
                            <p:column footerText="#{bean.sumTpr}"/>
                            <p:column footerText="#{bean.sumRoi}" rendered="false"/>
                        </p:row>
                    </p:columnGroup>
                </p:dataTable>
            </p:panel>
        </div>
    </h:form>
    <!-- 页脚 -->
    <div class="footer"></div>
</h:body>
</html>